﻿using ChBusiness.PubInfo;
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class Xnjc_ts_update : System.Web.UI.Page
{
    public  string id;
    public  string tsman = "";
    public  string tsdate = "";
    public  string tsobject = "";
    public  string tsiid = "";
    public  string tsinfo = "";
    TsInfoManager tsinfomanager = new TsInfoManager();

    protected void Page_Load(object sender, EventArgs e)
    {
        id = Request.QueryString["id"].ToString();
        System.Data.DataTable rs = tsinfomanager.YwinfoById(id);
        if (rs.Rows.Count > 0)
        {
            this.s_tsman.Value = rs.Rows[0][0].ToString();
            this.submitDate.Value = rs.Rows[0][1].ToString();
            this.s_tsInfo.Value = rs.Rows[0][2].ToString();
            this.s_tsobject.Value = rs.Rows[0][3].ToString();
            this.s_tsiid.Value = rs.Rows[0][4].ToString();
        }
        if (tsiid == null)
        {
            tsiid = "";
        }
        if (tsobject == null)
        {
            tsobject = "";
        }
    }

    protected void s_save_Click(object sender, EventArgs e)
    {
        tsman = this.s_tsman.Value.ToString();
        tsdate = this.submitDate.Value.ToString();
        tsobject = this.s_tsobject.Value.ToString();
        tsiid = this.s_tsiid.Value.ToString();
        if (tsinfomanager.UpdateTsInfo(id, tsman, tsdate, tsiid, tsobject, "") != 0)
        {
            Page.ClientScript.RegisterStartupScript(this.GetType(), "ok", "<script>alert('保存成功')</script>");
        }
        else
        {
            Page.ClientScript.RegisterStartupScript(this.GetType(), "ok", "<script>alert('输入数据异常，请检查后重试!')</script>");
        }
    }
}
